package org.lzfto.flink.demo.table.service;

import org.apache.flink.configuration.Configuration;
import org.apache.flink.table.api.TableConfig;

public interface FlinkConnectorTestService {
	
	void run() throws Exception;
	
	/**
	 * 获取一个全局的低级被设置
	 * </br> 参考：https://nightlies.apache.org/flink/flink-docs-release-1.20/docs/dev/table/config/
	 * @return
	 */
	default Configuration  createLowLevelConfig() {
		Configuration configuration = new Configuration();
		// set low-level key-value options
		configuration.setString("table.exec.mini-batch.enabled", "true");
		configuration.setString("table.exec.mini-batch.allow-latency", "5 s");
		configuration.setString("table.exec.mini-batch.size", "5000");
		return configuration;
	}
	
	
	/**
	 * 获取一个表级别设置
	 * @return
	 */
	default TableConfig  createTableLevelConfig() {
		TableConfig  tableConfig = TableConfig.getDefault();
		// set low-level key-value options
		tableConfig.set("table.exec.mini-batch.enabled", "true");
		tableConfig.set("table.exec.mini-batch.allow-latency", "5 s");
		tableConfig.set("table.exec.mini-batch.size", "5000");
		return tableConfig;
	}

}
